import { _decorator, Component, Enum, Vec2 } from 'cc';
const { ccclass, property, executeInEditMode } = _decorator;


enum objType {
    E_oStatic = 1,
    E_oSprites = 2,
    E_oSpin = 3,
}
Enum(objType)
// ccenum(objType)

// @ccclass('comObject')
// @executeInEditMode(true)

enum Type {
    one = 1,
    two = 2,
    three = 3,
    four = 4,
    five = 5,
}
Enum(Type);
@ccclass('comObject')
@executeInEditMode(true)

export class comObject extends Component {
    private isShowBool: boolean = true
    private isShowRoad: boolean = false


    @property({ type: objType, tooltip: "物品类型" })
    private _oType: objType = objType.E_oSpin;
    public get oType(): objType {
        return this._oType;
    }
    public set oType(value: objType) {
        this._oType = value;
    }
    @property({ type: objType })


    @property({ tooltip: "是否可移动", visible: false }) private _canMove: boolean = false;
    @property({
        tooltip: "是否可移动",
        visible: function (this) {
            return this.isShowBool;
        }
    })
    public get canMove(): boolean {
        return this._canMove;
    }
    public set canMove(value: boolean) {
        this.isShowRoad = this._canMove = value;
        console.log("修改当前节点是否可移动..", this._canMove)
    }

    /**路径 */
    @property({ type: [Vec2], tooltip: "移动路径", visible: false })
    public _road: Vec2[] = [];
    @property({
        visible: function (this) {
            return this.isShowRoad
        }
    })
    public get road(): Array<Vec2> {
        return this._road;
    }
    public set road(value: Array<Vec2>) {
        this._road = value;
        this.displayTmpRoad()
    }

    displayTmpRoad() {
        console.log("diplayRoad::", this._road)
    }

    protected onLoad(): void {
        console.log("添加通用物品组件成功")
    }

    start() {

    }

    update(deltaTime: number) {

    }
}


